<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <title>Facelet Title</title>
    </h:head>
    <h:body>
        <ui:composition template="/templates/default.xhtml">
            <ui:define name="content">
                <h:form>
                    <h:commandButton value="#{locale.buttonNewCourse}" action="#{newCourse.addNewCourse}" rendered="#{user.isAdminresource}"/>
                    <h:commandButton value="#{locale.buttonExport}" action="#{myCourses.navToExportCourses}" rendered="#{user.isStudyadmin}"/>
                    <p/>
                    <h:dataTable value="#{myCourses.courses}" var="c" >
                        <h:column>
                            <f:facet name="header">
                                #{locale.dtHeaderCourseCode}
                            </f:facet>
                            <h:outputText value="#{c.courseCode}" />
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                #{locale.dtHeaderCourseName}
                            </f:facet>
                            <h:outputText value="#{c.courseName}" />
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                #{locale.dtHeaderCourseLevel}
                            </f:facet>
                            <h:outputText value="#{c.courseLevel}" />
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                #{locale.dtHeaderSemester}
                            </f:facet>
                            <h:outputText value="#{c.semester}" />
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                #{locale.dtHeaderStudyProgram}
                            </f:facet>
                            <h:outputText value="#{c.studyprogram.name}" />
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                #{locale.dtHeaderDepartment}
                            </f:facet>
                            <h:outputText value="#{c.studyprogram.department.name}" />
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                #{locale.dtHeaderInstitute}
                            </f:facet>
                            <h:outputText value="#{c.studyprogram.department.institute.name}" />
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                #{locale.dtHeaderView}
                            </f:facet>
                            <h:commandButton value="#{locale.buttonView}" action="#{myCourses.navToViewCourse(c)}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                #{locale.dtHeaderEdit}
                            </f:facet>
                            <h:commandButton value="#{locale.buttonEdit1}" action="#{myCourses.navToViewEditCourse(c)}" rendered="#{user.isTeacher}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                #{locale.dtHeaderEdit}
                            </f:facet>
                            <h:commandButton value="#{locale.buttonEdit2}" rendered="#{user.isAdminresource}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                #{locale.dtHeaderDelete}
                            </f:facet>
                            <h:commandButton value="#{locale.buttonDelete}" action="#{myCourses.setDeleteFlagAndNavigate(c)}" rendered="#{user.isAdminresource}" />
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                #{locale.dtHeaderExport}
                            </f:facet>
                            <h:commandButton value="#{locale.buttonExport}" action="#{myCourses.navToExportCourses}" rendered="#{user.isStudyadmin}" />
                        </h:column>
                    </h:dataTable>
                </h:form>
            </ui:define>
        </ui:composition>
    </h:body>
</html>